import {
  SAVE_PRODUCT
} from './constant'

const defatState = {
  pageNum: 1,
  total: 0,
  pages: 0,
  pageSize: 0,
  productList: []
}

export default function adminReducer(state = defatState, action) {
  switch (action.type) {
    case SAVE_PRODUCT:
      return {
        ...state,
        pageNum: action.product.pageNum,
          total: action.product.total,
          pages: action.product.pages,
          pageSize: action.product.pageSize,
          productList: action.product.list,
      }
      default:
        return state
  }
}